package com.example.wechat.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.wechat.model.Group;

@Mapper
public interface GroupRepository extends BaseMapper<Group>{

	@Select("SELECT g.* FROM chat_group g JOIN group_member gm ON g.id = gm.group_id WHERE gm.user_id = #{userId}")
	List<Group> findByMembersContaining(@Param("userId") String userId);
}